@extends('Admin.layout.layout')
@section('title','用户列表')
@section('home','用户管理')
@section('weizhi','用户列表')
@section('con')

@if(session('success'))
  <div class="alert alert-success fade in">
      {{session('success')}}
  </div>
@endif

<div class="row">
    <div class="col-lg-12">
        <section class="panel">
            <header class="panel-heading" style="display:block;position:relative;">
               <font style="display:block;position:absolute;float:left"><font>用户列表</font></font>
                <div class="nav search-row" id="top_menu" style="position: absolute;float: left;margin-left: 100px;margin-top: 6px;">
                    <!--  search form start -->
                    <ul class="nav top-menu">                    
                        <li style="border:0px">
                            <form class="navbar-form" method="get" action="{{url('/admin/user/index')}}">
                                <input class="form-control" placeholder="Search" name="keywords" value="{{$data['keywords'] or ''}}" type="text">
                                <!-- <a class="btn btn-default" href="" title="引导3个主题发生器"> -->
                                <button class="btn btn-default"><span class="icon_cloud-upload_alt"></span><font><font class=""> 搜索</font></font></button>
                                <!-- <button class="btn btn-primary" >搜索</button> -->
                                
                            </form>
                        </li>                    
                    </ul>
                    <!--  search form end -->                
                </div>
            </header>
            
            <table class="table table-striped table-advance table-hover">
             <tbody>
                <tr>
                   <th><i class="icon_profile"></i><font><font> 编号</font></font></th>
                   <th><i class="icon_profile"></i><font><font> 全名</font></font></th>
                   <th><i class="icon_calendar"></i><font><font> 密码</font></font></th>
                   <th><i class="icon_mail_alt"></i><font><font> 权限</font></font></th>
                   <th><i class="icon_pin_alt"></i><font><font> 状态</font></font></th>
                   <th><i class="icon_mobile"></i><font><font> 等级</font></font></th>
                   <th><i class="icon_cogs"></i><font><font> 行动</font></font></th>
                </tr>
                @foreach($users as $k => $v)
                <tr>
                   <td><font><font>{{$v -> id}}</font></font></td>
                   <td><font><font>{{$v -> username}}</font></font></td>
                   <td><font><font>{{$v -> password}}</font></font></td>
                   <td><font><font>{{$v -> auth}}</font></font></td>
                   <td><font><font>{{str_replace([0,1],['未激活','激活'],$v -> status)}}</font></font></td>
                   <td><font><font>{{str_replace([0,1,2],['普通会员','会员','管理员'],$v -> grade)}}</font></font></td>
                   <td>
                    <div class="btn-group">
                        <a class="btn btn-primary" href="{{url('/admin/user/add')}}"><i class="icon_plus_alt2"></i></a>
                        <a class="btn btn-success" href="{{url('/admin/user/edit',['id'=>$v->id])}}"><i class="icon_check_alt2"></i></a>
                        <a id='del' class="btn btn-danger" href="{{url('/admin/user/delete',['id'=>$v->id])}}"><i class="icon_close_alt2"></i></a>
                    </div>
                    </td>
                </tr>
                @endforeach                   
             </tbody>
          </table>
          <!-- 分页 -->
          <div style="text-align: center;">
          <!-- {!! $users -> render() !!} -->
          {!! $users -> appends($data) -> render() !!}       
            
          </div>
        </section>
    </div>
</div>

  <script type="text/javascript">
    var del = document.getElementById('del');
    // console.log(del);
    //绑定单击事件
    del.onclick = function(){
      res = confirm('确认删除该用户?');
      // console.log(res);
      if(!res){
        return false;
      }
    }

  </script>


@endsection





